<?php

use yii\helpers\Html;
use kartik\grid\GridView;
use common\models\business\BusinessDisease;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\business\models\BusinessDiseaseSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '疾病数据';
$this->params['breadcrumbs'][] = $this->title;
?>


<section class="wrapper site-min-height">
    <!-- page start-->
    <section class="panel">
        <header class="panel-heading">
              <?= Html::a('返回','javascript:history.back(-1)'); ?>  <?= Html::encode($this->title) ?>
        </header>
        <div class="panel-body">
            <div class="adv-table editable-table ">
 


<div class="business-disease-index">

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>




    <?php
    echo GridView::widget([
        'dataProvider'=>$dataProvider,
        'filterModel'=>$searchModel,
        'showPageSummary'=>true,
        'pjax'=>true,
        'striped'=>true,
        'hover'=>true,
        'panel'=>['type'=>'primary', 'heading'=>'疾病数据'],
        'containerOptions'=>['style'=>'overflow: auto'], // only set when $responsive = false
        'headerRowOptions'=>['class'=>'kartik-sheet-style'],
        'filterRowOptions'=>['class'=>'kartik-sheet-style'],
        'columns'=>[
            [
                'attribute'=>'pig.no',
                'pageSummaryOptions'=>['class'=>'text-right text-warning'],
                'width'=>'100px',
            ],

            [
                'attribute'=>'person',
                'pageSummaryOptions'=>['class'=>'text-right text-warning'],
                'width'=>'100px',
            ],
            [
                'attribute'=>'type',
                'pageSummaryOptions'=>['class'=>'text-right text-warning'],
                'width'=>'100px',
            ],
            [
                'attribute'=>'detail',
                'pageSummaryOptions'=>['class'=>'text-right text-warning'],
                'width'=>'100px',
            ],
            [
                'attribute'=>'step',
                'width'=>'80px',
                'format' => 'raw',
                'value'=>function ($model, $key, $index, $widget) {
                    if($model->step == BusinessDisease::WAIT_DIAGNOSTICS){
                        $style = 'btn-danger';
                    }else if($model->step == BusinessDisease::DIAGNOSTICS_ING){
                        $style = 'btn-info';
                    }else if($model->step == BusinessDisease::PATIENTS_ING){
                        $style = 'btn-primary';
                    }else if($model->step == BusinessDisease::RECOVERED){
                        $style = 'btn-success';
                    }
                    return Html::label(BusinessDisease::$steps[$model->step],'',['class'=>'btn btn-xs '.$style]);
                },
                'filterType'=>GridView::FILTER_SELECT2,
                'filter'=> BusinessDisease::$steps,
                'filterWidgetOptions'=>[
                    'pluginOptions'=>['allowClear'=>true],
                ],
                'filterInputOptions'=>['placeholder'=>'目前疾病阶段','style'=>'width:50px']
            ],
            [
                'attribute'=>'createtime',
                'value' => function($model){
                    return date('Y-m-d H:i:s',$model->createtime);
                },
                'pageSummaryOptions'=>['class'=>'text-right text-warning'],
                'width'=>'100px',
            ],
            [
                'class' => '\kartik\grid\ActionColumn',
                'deleteOptions' => ['label' => '<i class="glyphicon glyphicon-remove"></i>']
            ],

            [
                'class' => '\kartik\grid\CheckboxColumn'
            ]
        ],
        'toolbar'=> [
            Yii::$app->request->get('id') !== null?[
                'content' => Html::button('<i class="glyphicon glyphicon-plus"></i>', ['type'=>'button', 'title'=>'选中归为档案', 'class'=>'btn btn-success', 'id'=>'addpig'])
            ]:'',
            '{export}',
            '{toggleData}',
        ],
        'bordered'=>true,
        'condensed'=>true,
    ]);
    ?>


</div>
</div>
</div>
</section>
</section>





